package com.ly.system.service.impl;

import java.util.List;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import com.ly.common.utils.DateUtils;
import com.ly.common.utils.erp.SnowflakeIdWorker;
import com.ly.system.mapper.UserMajorSocialRelationMapper;
import com.ly.system.service.IUserMajorSocialRelationService;
import org.springframework.stereotype.Service;
import com.ly.common.core.domain.entity.UserMajorSocialRelationEntity;

import javax.annotation.Resource;


/**
 * 用户家庭成员及主要社会关系Service业务层处理
 * @author wutao
 * @date 2024-05-29
 */
@Service
public class UserMajorSocialRelationServiceImpl extends ServiceImpl<UserMajorSocialRelationMapper, UserMajorSocialRelationEntity> implements IUserMajorSocialRelationService {

    @Resource
    private UserMajorSocialRelationMapper userMajorSocialRelationEntityMapper;

    /**
     * 查询用户家庭成员及主要社会关系
     * @param id 用户家庭成员及主要社会关系ID
     * @return 用户家庭成员及主要社会关系
     */
    @Override
    public UserMajorSocialRelationEntity selectUserMajorSocialRelationEntityById (String id) {
        return userMajorSocialRelationEntityMapper.selectUserMajorSocialRelationEntityById ( id );
    }

    /**
     * 查询用户家庭成员及主要社会关系列表
     * @param userMajorSocialRelationEntity 用户家庭成员及主要社会关系
     * @return 用户家庭成员及主要社会关系
     */
    @Override
    public List<UserMajorSocialRelationEntity> selectUserMajorSocialRelationEntityList (UserMajorSocialRelationEntity userMajorSocialRelationEntity) {
        return userMajorSocialRelationEntityMapper.selectUserMajorSocialRelationEntityList ( userMajorSocialRelationEntity );
    }

    /**
     * 新增用户家庭成员及主要社会关系
     * @param userMajorSocialRelationEntity 用户家庭成员及主要社会关系
     * @return 结果
     */
    @Override
    public int insertUserMajorSocialRelationEntity (UserMajorSocialRelationEntity userMajorSocialRelationEntity) {
        userMajorSocialRelationEntity.setId ( SnowflakeIdWorker.getInstance ().nextStringId () );
        userMajorSocialRelationEntity.setCreateTime ( DateUtils.getNowDate () );
        return userMajorSocialRelationEntityMapper.insertUserMajorSocialRelationEntity ( userMajorSocialRelationEntity );
    }

    /**
     * 修改用户家庭成员及主要社会关系
     * @param userMajorSocialRelationEntity 用户家庭成员及主要社会关系
     * @return 结果
     */
    @Override
    public int updateUserMajorSocialRelationEntity (UserMajorSocialRelationEntity userMajorSocialRelationEntity) {
        userMajorSocialRelationEntity.setUpdateTime ( DateUtils.getNowDate () );
        return userMajorSocialRelationEntityMapper.updateUserMajorSocialRelationEntity ( userMajorSocialRelationEntity );
    }

    /**
     * 批量删除用户家庭成员及主要社会关系
     * @param ids 需要删除的用户家庭成员及主要社会关系ID
     * @return 结果
     */
    @Override
    public int deleteUserMajorSocialRelationEntityByIds (String[] ids) {
        return userMajorSocialRelationEntityMapper.deleteUserMajorSocialRelationEntityByIds ( ids );
    }

    /**
     * 删除用户家庭成员及主要社会关系信息
     * @param id 用户家庭成员及主要社会关系ID
     * @return 结果
     */
    @Override
    public int deleteUserMajorSocialRelationEntityById (String id) {
        return userMajorSocialRelationEntityMapper.deleteUserMajorSocialRelationEntityById ( id );
    }
}
